<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateKmsAlbumResource extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('kms_album_resource', function (Blueprint $table) {
            $table->id();

            $table->string("resourceNo")->default("")->comment("资源编号");
            $table->bigInteger("mid")->comment("相册主表ID operate_album_main.id");

            $table->string("poiNo", 36)->default("")->comment("poi.id 高德poi代表id 夸父poi代表网规编号");
            $table->tinyInteger("poiSource")->default(0)->comment("poi来源 1 - 夸父 2 - 高德");
            $table->string("poiType", 36)->default("")->comment("poi类型");
            $table->string("poiName")->default("")->comment("poi名称");


            $table->string('long', 32)->default('')->comment('经度');
            $table->string('lat', 32)->default('')->comment('纬度');

            $table->date("date")->default("0000-00-00")->comment("创建日期");
            $table->tinyInteger("weekDay")->default(0)->comment("周几");

            $table->string("addressPrefix", 48)->default("")->comment("地址前缀 - 省市区");
            $table->string("addressSuffix", 120)->default("")->comment("地址后缀 - 详细地址");

            $table->string("weather", 36)->default("")->comment("天气");
            $table->string("creatorUsername", 36)->default("")->comment("创建人名称");

            $table->tinyInteger("type")->default(0)->comment("资源类型 0 - 图片 1 - 视频");
            $table->string("originalUrl")->default("")->comment("资源原始路径");
            $table->string("previewUrl")->default("")->comment("资源预览路径");
            $table->unsignedBigInteger("size")->default(0)->comment("资源大小");
            $table->string("resolutionRatio", 36)->default("")->comment("分辨率");
            $table->unsignedInteger('videoDuration')->default(0)->comment('视频时长');

            $table->tinyInteger("isInRecycleBin")->default(0)->comment("是否加入回收站 0 - 否 1 - 是");

            $table->string("fsImgKey")->default("")->comment("飞书imgKey");
            $table->unsignedInteger('isDeleted')->default(0)->comment('是否删除 0 - 正常 1 - 已删除');

            $table->unsignedInteger('shootingTime')->default(0)->comment('拍摄时间');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->unsignedInteger('deletedAt')->default(0)->comment('删除时间时间');

            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '运营app - 相册资源';
            $table->index(["mid", "isInRecycleBin", "isDeleted"], 'idx_mid_isInRecycleBin_isDeleted');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('kms_album_detail');
    }
}
